<h1>Listing radchecks</h1>

<table class="table table-striped">
  <thead>
    <tr>
      <th>Attr</th>
      <th>Op</th>
      <th>Value</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% @radchecks.each do |radcheck| %>
      <tr>
        <td><%= radcheck.attr %></td>
        <td><%= radcheck.op %></td>
        <td><%= radcheck.value %></td>
        <td>
            <%= link_to btn_icon(:edit), edit_polymorphic_path([@radcheckable, radcheck]) %>
            <% unless radcheck.attr == Settings.check_types['password']%>
                <%= link_to btn_icon(:trash), polymorphic_path([@radcheckable, radcheck]), method: :delete, data: { confirm: 'Are you sure?' } %>
            <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<% if @radcheckable.class.name == 'User' %>
    <%= link_to 'New Radcheck', new_user_radcheck_path(@radcheckable), class: "btn btn-primary btn-mini" %>
<% else %>
    <%= link_to 'New Radcheck', new_device_radcheck_path(@radcheckable), class: "btn btn-primary btn-mini" %>
<% end %>
